<?php include("../header.php"); ?>
<script src="/erp/public/datepicker/js/bootstrap-datepicker.js"></script>
<link  href="/erp/public/datepicker/css/datepicker.css" rel="stylesheet">
<script src="brand.js"></script>
<style>
    .ui-autocomplete {
        z-index: 1100;
    }
</style>



<div class="row">
    <div class="col-md-12">
        <!-- Home chart widget -->
        <div class="widget">
            <div class="widget-head br-lblue">
                <h3 class="pull-left"><i class="fa fa-bar-chart-o"></i> Compra</h3>

                <div class="clearfix"></div>
            </div>
            <div class="widget-body" >
                <div class="row">

                    <div class="container">

                        <table id="itemsTable" class="  table-condensed">
                            <thead>
                                <tr>
                                    <th style="width: 5%"></th>
                                    <th style="width: 10%"></th>
                                    <th style="width: 30%"></th>
                                    <th style="width: 5%"></th>
                                    <th style="width: 12%"></th>
                                    <th style="width: 8%"></th>
                                    <th style="width: 12%"></th>
                                    <th style="width: 8%"></th>
                                    <th style="width: 5%"></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr class="item-row">
                                    <td></td>
                                    <th>Proveedor</th>
                                    <td>
                                        <div class="input-group">
                                            <input type="hidden" id = "supplier_id" >
                                            <input type="text" id = "supplier_name" class="form-control" readonly="readonly">
                                            <span id="btn_dialog_show_supplier" class="input-group-addon"><i class="fa fa-search blue"></i></span>
                                        </div>
                                    </td>
                                    <td></td>
                                    <th>Fecha Emision</th>
                                    <td>
                                        <input type="text" id="emission_date" class="form-control input-sm" >
                                    </td>
                                    <th>Fecha Cancelacion</th>
                                    <td>
                                        <input type="text" id="cancellation_date" class="form-control input-sm" >
                                    </td>
                                </tr>
                                <tr class="item-row">
                                    <td></td>
                                    <th>RUC</th>
                                    <td>
                                        <input type="text" id="supplier_ruc" class="form-control input-sm" readonly="readonly">
                                    </td>
                                    <td></td>
                                    <th>Serie</th>
                                    <td>
                                        <input type="text" id="serie" class="form-control input-sm" >
                                    </td>
                                    <th>Numero</th>
                                    <td>
                                        <input type="text" id="numero" class="form-control input-sm" >
                                    </td>
                                </tr>
                                <tr class="item-row">
                                    <td></td>
                                    <th>Direccion</th>
                                    <td>
                                        <input type="text" id="supplier_address" readonly="readonly" class="form-control input-sm" >
                                    </td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="row">
                    <div class="container">
                        <table id="detail" class="table table-striped table-condensed">

                            <thead>
                                <tr>
                                    <th style="width: 60%">Description</th>
                                    <th style="width: 5%">Qty</th>
                                    <th style="width: 15%">Price</th>
                                    <th style="width: 15%">Total</th> 
                                    <th style="width: 5%"></th>
                                </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                        <a class="btn btn-success" id="btn_dialog_show_product" href="#"><i class="fa fa-plus"></i> Add Item</a>
                    </div>
                </div>
                <hr>
                <div class="row">
                    <div class="col-md-8">
                    </div>
                    <div class="col-md-4 text-right">
                        <table>
                            <tr>
                                <td>
                                    <h5>Sub Total:</h5>
                                </td>
                                <td>
                                    <div class="input-group"  style="padding-bottom: 5px;">
                                        <span class="input-group-addon">S/.</span>
                                        <input type="text" style="text-align:right" readonly="readonly" class="form-control input-sm" value="0.00" id="subtotal_g">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><h5>IGV (18%):</h5></td>
                                <td>
                                    <div class="input-group"  style="padding-bottom: 5px;">
                                        <span class="input-group-addon">S/.</span>
                                        <input type="text" style="text-align:right" readonly="readonly" class="form-control input-sm" value="0.00" id="igv_g">
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td><h5>Total:</h5></td>
                                <td>
                                    <div class="input-group"  style="padding-bottom: 5px;">
                                        <span class="input-group-addon">S/.</span>
                                        <input type="text" style="text-align:right" readonly="readonly" class="form-control input-sm" value="0.00" id="total_g">
                                    </div>
                                </td>
                            </tr>
                        </table>

                        <a class="btn btn-primary pull-right" id="add_invoice" href="#"><i class="fa fa-save"></i> Grabar</a>


                    </div>
                </div>

            </div>					
        </div>
    </div>
</div>
<!-- Dialog -->
<div class="modal fade" id="div_dialog_supplier" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">       
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="div_dialog_title" id="myModalLabel">Buscar Proeedor</h4>
            </div>
            <div class="modal-body">
                <input type="hidden" id="aux_supplier_id" />
                <input type="hidden" id="aux_supplier_name" />
                <input type="hidden" id="aux_supplier_ruc" />
                <input type="hidden" id="aux_supplier_address" />
                <form id="form_dialog_crud" class="form-horizontal" role="form">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">Nombre</label>
                        <div class="col-lg-10">
                            <input id="txt_search_supplier" name="txt_search_supplier" type="text" class="form-control" placeholder="Proveedor" value="">
                        </div>

                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                <button id="btn_dialog_supplier_select" type="button" class="btn btn-primary">Seleccionar</button>

            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="div_dialog_product" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="loader" style="display:none;height: 150px">
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="div_dialog_title" id="myModalLabel">Buscar Producto</h4>
            </div>
            <div class="modal-body"  style="padding-bottom: 0px;">
                <form id="form_dialog_crud" class="form-horizontal" role="form">
                    <div class="form-group">
                        <input type="hidden" id="aux_product_id" />
                        <label class="col-lg-2 control-label">Nombre</label>
                        <div class="col-lg-10"  style="padding-bottom: 5px;">
                            <input id="txt_search_product" type="text" class="form-control" placeholder="Nombre">
                        </div>
                        <label class="col-lg-2 control-label">Stock</label>
                        <div class="col-lg-10"  style="padding-bottom: 5px;">
                            <input id="txt_stock_product"  type="text" class="form-control" readonly="readonly" placeholder="Stock" value="">
                        </div>
                        <label class="col-lg-2 control-label">Precio</label>
                        <div class="col-lg-10"  style="padding-bottom: 5px;">
                            <input id="txt_price_product"  type="text" class="form-control" placeholder="Precio" value="">
                        </div>
                        <label class="col-lg-2 control-label">Cantidad</label>
                        <div class="col-lg-10"  style="padding-bottom: 5px;">
                            <input id="txt_quantity_product"  type="text" class="form-control" placeholder="Cantidad" value="">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
                <button id="btn_dialog_product_select" type="button" class="btn btn-primary">Agregar</button>
                <button id="btn_dialog_product_editar" type="button" class="btn btn-primary">Editar</button>
            </div>
        </div>
    </div>









    <?php include("../footer.php"); ?>
                        